#include "resource_manager.h"


namespace kanon
{
    ResourceManager::ResourceManager()
    {
        // add default white color texture for color rendering.
    }

    std::shared_ptr<Texture2D> ResourceManager::get_texture(const std::string& texture_path)
    {
        auto it = textures.find(texture_path);
        if (it != textures.end())
            return it->second;

        // create texture
        std::shared_ptr<Texture2D> tex = std::make_shared<Texture2D>(texture_path);
        textures.insert(std::make_pair(texture_path, tex));
        return tex;
    }

    ResourceManager g_resource_manager;

    std::shared_ptr<Texture2D> get_texture(const std::string& texture_path)
    {
        return g_resource_manager.get_texture(texture_path);
    }
}
